package com.duoketech.model.activity;
import com.duoketech.model.AbstractModel;
import com.duoketech.utils.PageUtil;

import java.util.List;

public class Activity extends AbstractModel<Activity>{
    public static final Activity dao = new Activity();

    public static final String ID = "id";//
    public static final String NAME = "name";//活动名称
    public static final String DESC = "desc";//活动描述
    public static final String PRICE = "price";//活动价格
    public static final String START_TIME = "start_time";//开始时间
    public static final String END_TIME = "end_time";//结束时间
    public static final String CONTENT = "content";//活动内容
    public static final String STATUS = "status";//活动状态
    public static final String CONTACTOR = "contactor";//联系人
    public static final String MOBILE = "mobile";//联系电话
    public static final String CREATE_TIME = "create_time";//创建时间
    public static final String MODIFY_TIME = "modify_time";//更新时间
    public static final String ADDRESS = "address";//集合地点
    public static final String CREATOR = "creator";//创建人
    public static final String IMGS = "imgs";//创建人

    public final int STATUS_START=1;
    public final int STATUS_CANCEL=2;
    public final int STATUS_END=3;
    public static final int STATUS_WX_SYNC=4;
    @Override
    public String tableName() {
        return "t_activity";
    }

    @Override
    public String status() {
        return statusConvert(getInt(STATUS));
    }

    public String statusConvert(int code){
        String result="未知";
        if(code==STATUS_NORMAL){
            result="接受报名";
        }else if(code==STATUS_START){
            result="活动开始";
        }else if(code==STATUS_END){
            result="活动结束";
        }else if(code==STATUS_CANCEL){
            result="活动取消";
        }else if(code==STATUS_WX_SYNC){
            result="等待编辑";
        }
        return result;
    }


    public String startTime(){

        return PageUtil.formatDataYYMMDD(getDate(START_TIME));
    }

    public String endTime(){
        return PageUtil.formatDataYYMMDD(getDate(END_TIME));
    }

    public String createTime(){
        return PageUtil.formatDataYYMMDD(getDate(CREATE_TIME));
    }

    public List<String> imgs(){

        return PageUtil.imgs(getStr(IMGS));
    }
    public String price(){
        return PageUtil.fengToYuan(getInt(PRICE))+"";
    }
}